﻿package com.msjt.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.msjt.dao.VideoDAO;
import com.msjt.entity.Video;
import com.msjt.service.IVideoService;

/**
 * name:VideoService
 * function:视频模块业务逻辑
 * author: kw
 * time:2013.8.27
 * updateTime:
 */
public class VideoService implements IVideoService {
	@Resource
	private VideoDAO videoDao;

	public VideoDAO getVideoDao() {
		return videoDao;
	}

	public void setVideoDao(VideoDAO videoDao) {
		this.videoDao = videoDao;
	}
	
	//主页面加载视频地址，最后上传的视频将显示在主页
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IVideoService#getVideoIndex()
	 */
	public Video getVideoIndex(){
		return this.videoDao.getVideoIndex();
	}
	//前台后台查看视频列表，只加载ID，视频描述，日期，视频在点开后才加载
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IVideoService#getVideoPage(int, int)
	 */
	public List<Video> getVideoPage(int pageIndex,int pageSize){
		return this.videoDao.getVdeoByPage(pageIndex, pageSize);
	}
	//新上传视频
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IVideoService#addVideo(com.msjt.entity.Video)
	 */
	public boolean addVideo(Video video){
		return this.videoDao.addVideo(video);
	}
	//修改视频信息
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IVideoService#updateVideo(com.msjt.entity.Video)
	 */
	public boolean updateVideo(Video video){
		return this.videoDao.updateVideo(video);
	}
	//删除视频
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IVideoService#deleteVideo(com.msjt.entity.Video)
	 */
	public boolean deleteVideo(Video video){
		return this.videoDao.deleteVideo(video);
	}
	//根据ID得到视频的详细信息
	/* (non-Javadoc)
	 * @see com.msjt.service.impl.IVideoService#getVideoInfo(com.msjt.entity.Video)
	 */
	public Video getVideoInfo(Video video){
		return this.videoDao.getOneVideo(video);
	}

	public Integer getVideoCount() {
		return this.videoDao.getVideoCount();
	}

	public boolean deleteMore(String idString) {
		return this.videoDao.deleteMore(idString);
	}

	public List<String> getVideoPath(String idString) {
		// TODO Auto-generated method stub
		return this.videoDao.getVideoPath(idString);
	}
}
